Repository navigation
Conversation
With two or more radars, the background weight for each pair was taken from bg_weights[k] (k is the height level) but accumulated into bg_weights[i] (i is the radar index). Levels 0 to len(Grids) - 1 picked up the background mask of every other level, so the background constraint was applied over the whole of the lowest levels, including points with dual-Doppler coverage. User-supplied weights_bg had the same problem: only its first len(Grids) levels were used. Accumulate into bg_weights[k] from a copy, as is already done for the radar weights, and take weights_bg[k] for each level. Fixes openradar#142
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #177 +/- ##
==========================================
+ Coverage 61.26% 61.32% +0.06%
==========================================
Files 34 34
Lines 6012 6020 +8
==========================================
+ Hits 3683 3692 +9
+ Misses 2329 2328 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #142
#143 stopped
cur_arrayaliasing the radar weights. The background weights a few lines below still have a problem, which the #143 description already suspected. In both the SciPy and TensorFlow engines, with two or more radars:kis read frombg_weights[k]but added tobg_weights[i], whereiis the radar index and not a height level. So levels 0 tolen(Grids) - 1collect the background mask of every other level. In the TWP-ICE example, levels 0 and 1 end up with a background weight of 1 everywhere, including the roughly 16% of each level that has dual-Doppler coverage. All other levels are the exact complement of the coverage.weights_bgis passed in,bg_weights[i] = weights_bg[i]copies only the firstlen(Grids)levels, and the rest stay 0.This change adds into
bg_weights[k]from a copy, the same way the radar weights now work, and usesweights_bg[k]for each level.Testing: I added
test_twpice_case_bg_weightstotest_retrieval.py. It checks that the automatic background weights are the complement of the radar coverage at every level, and that a suppliedweights_bgis used unchanged. It fails onmain(4663 mismatched points, all in levels 0 and 1) and passes with this change. I ran the same check against the TensorFlow engine, which shows the same mismatch onmainand none with the fix.pytest pydda/testspasses, apart from three tests that fail because this machine has no network access to IEM and nocfgrib(HRRR). The TensorFlow tests pass, and pre-commit (black, ruff) is clean.